"use strict";
import Vue from 'vue'
import App from './App.vue'

import router from "./router";
import store from "./store";

import GlobalMixin from "./mixin/GlobalMixin"

import ElementUI from 'element-ui';


//import '@/assets/index.css';
//import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/icon/iconfont.css';
//import '@/assets/index.css';
import 'element-ui/lib/theme-chalk/index.css';

import '@/assets/element-variables.css';

import md5 from 'js-md5';
import hljs from 'highlight.js';
import 'highlight.js/styles/atom-one-dark.css';
Vue.use(hljs);


import components from '@/components';

Vue.use(components);

// 引入echarts
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
Vue.prototype.$md5 = md5

import { marked }from 'marked';
	// 引入代码高亮样式
//import "highlight.js/styles/darcula.css";
Vue.prototype.$marked = marked



Vue.use(ElementUI);
Vue.config.productionTip = false
Vue.mixin(GlobalMixin);



Vue.directive('highlight', (el) => {
  let blocks = el.querySelectorAll('pre code')
  blocks.forEach((block) => {

	// 创建ol标签元素
	let ol = document.createElement("ol");

    // 2.根据换行符获取行数，根据获取的行数生成行号
    let rowCount = block.outerHTML.split('\n').length;
    for(let i=1;i < rowCount;i++){
      // 创建li标签元素
      let li = document.createElement("li");
      let text = document.createTextNode(''+i);
      // 将生成的行号添加到li标签中
      li.appendChild(text);
      // 将li标签添加到ol标签中
      ol.appendChild(li);
    }
    // 为ol标签添加class名
    ol.className = 'pre-numbering';
    block.parentNode.appendChild(ol);

    hljs.highlightBlock(block)
});
});



store.dispatch('initDict').then(() => {
	store.dispatch('initUserList').then(() => {
		store.dispatch('initSystemList').then(() => {
			
			store.dispatch('initOrgList').then(() => {
				new Vue({
					router,
					store,
					render: h => h(App),
				}).$mount('#app');

			});
		})
	
	});
}).catch(error => {
});


	








